﻿using AppService.IService.Basic_information;
using AppService.IService.System_operation;
using AppService.Service.System_operation;
using Domain.Entity.Basic_information;
using Domain.Entity.System_operation;
using Microsoft.AspNetCore.Mvc;

namespace WebAPI.Controllers.Basic_information
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Ct_Controller : ControllerBase
    {
        private readonly ICt_Service Ict_Service;

        public Ct_Controller(ICt_Service ict_Service)
        {
            Ict_Service = ict_Service;
        }


        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpGet("{currentPage},{PageSize}")]
        public List<Customer_ment> GetCustomer_ments(int currentPage, int PageSize)
        {
            return Ict_Service.GetCustomer_ments(currentPage, PageSize);
        }
        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public bool DelCt(int id)
        {
            return Ict_Service.DelCt(id);
        }

        /// <summary>
        /// 添加客户信息
        /// </summary>
        /// <param name="customer">客户类</param>
        /// <returns></returns>
        [HttpPost]
        public bool AddCt([FromBody] Customer_ment customer)
        {
            return Ict_Service.AddCt(customer);
        }

        /// <summary>
        /// 修改客户信息
        /// </summary>
        /// <param name="customer_ment">客户类</param>
        /// <returns></returns>
        [HttpPut]
        public bool UpdCt([FromBody] Customer_ment customer_ment)
        {
            return Ict_Service.UpdCt(customer_ment);
        }

        /// <summary>
        /// 根据id查询客户信息
        /// </summary>
        /// <param name="id">司机id</param>
        /// <returns></returns>
        [HttpGet("{id}")]
        public Customer_ment GetCustomer(int id)
        {
            return Ict_Service.GetCustomer(id);
        }

        /// <summary>
        /// 条件查询
        /// </summary>
        /// <param name="value2"></param>
        /// <param name="Create_time"></param>
        /// <param name="currentPage"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpGet("{currentPage},{PageSize}")]
        public List<Customer_ment> Customer_condition(int currentPage, int PageSize, string? Create_time ,string? value2)
        {
            List<Customer_ment> customers = Ict_Service.Customer_condition(currentPage, PageSize, Create_time, value2);
            return customers;
        }
        [HttpGet]
        public int Count(string? Create_time, string? value2)
        {
            return Ict_Service.Count(Create_time,value2);
        }
    }
}
